<template>
  <div class="user">
      <div class="user_header">
          <div class="header_top">
              <img :src="avatarInfo" alt="">
          </div>
          <div class="header_bottom">您好!
              <span style="color:#FE672F">{{nameInfo}}</span>
          </div>
      </div>
      <div class="user_cell">
          <van-cell title="账户余额" icon="balance-o" is-link to="/manager/money"/>
          <van-cell title="常用地址" icon="location-o" is-link to="/manager/address"/>
          <van-cell title="我的评论" icon="records" is-link to="/manager/comment"/>
          <van-cell title="联系我们" icon="phone-o" is-link @click="dialogBox"/>
      </div>
      <div class="user_button">
          <van-button type="primary" block round @click="toLoginOut" color="#E25C42">退出</van-button>
      </div>
      <div class="app_nav">
      <van-tabbar v-model="active" active-color="#1E5EAE">
        <van-tabbar-item name="one" icon="home-o" to="/manager/index">首页</van-tabbar-item>
        <van-tabbar-item name="two" icon="orders-o" to="/manager/order">订单</van-tabbar-item>
        <van-tabbar-item name="three" icon="user-circle-o" to="/manager/user">我的</van-tabbar-item>
      </van-tabbar>
    </div>
  </div>
  
</template>

<script>
import { mapState, mapActions } from 'vuex'
import { Dialog } from 'vant';
export default {
    data(){
        return{
            active:'three'
        }
    },
    created(){
    },
    computed:{
        ...mapState('login',['avatarInfo','nameInfo'])
    },
    methods:{
        toLoginOut(){
            this.$router.push({path:'/login'})
            localStorage.removeItem('id')
            localStorage.removeItem('token')
            localStorage.removeItem('avatarInfo')
            localStorage.removeItem('nameInfo')
        },
        dialogBox(){
            Dialog.alert({
                title: '联系我们',
                message: '0471-1234-888',
} )
        }
    }
}
</script>
<style>
    .user_header{
        width:100%;
        height:200px
    }
    .header_top{
        margin:0 auto;
        padding-top:30px;
        text-align:center
    }
    .header_top img{
        width: 80px;
        height:80px;
        border-radius: 50%;
        margin:0 auto
    }
    .header_bottom{
        width:140px;
        height:35px;
        margin: 0 auto;
        text-align: center;
        border-radius: 20px;
        line-height:35px;
        margin-top:10px;
        border:1px solid #bbb;
    }
    .user_button{
        margin-top:20px;
        padding:0 30px;
    }
</style>
